package com.lanxiao.cloud.modules.user.domain.service.impl;

import com.lanxiao.cloud.common.core.utils.StringUtils;
import com.lanxiao.cloud.common.mybatis.service.impl.BaseServiceImpl;
import com.lanxiao.cloud.modules.user.domain.model.User;
import com.lanxiao.cloud.modules.user.domain.service.IUserService;
import com.lanxiao.cloud.modules.user.infrastructure.repository.UserMapper;
import org.springframework.stereotype.Service;

/**
 * @author ：qiaoliang
 * @date ：2021-09-13
 */
@Service
public class UserServiceImpl extends
    BaseServiceImpl<Long, UserMapper, User> implements
    IUserService {

  @Override
  public void updateUser(User user) {
    if(StringUtils.isNotBlank(user.getName())) {
      user.setInitials(StringUtils.getPinYinHeadChar(user.getName()));
    }
    this.updateById(user);
  }

}
